package com.zhi.syc.data.beans;

import android.os.Build;

import com.google.gson.Gson;
import com.zhi.syc.data.ASBuilder;
import com.zhi.syc.data.logger.ASLogger;
import com.zhi.syc.data.util.AESCryptUtilJar;
import com.zhi.syc.data.util.ASUtil;

public class ASDeviceInfoBean {
    public String path;
    public String appId;

    public String token;

    public String product;

    public String version;

    public String borrowId;

    //原来的数据----------------------------
    /**
     * 手机产品名
     */
    public String phoneModel = Build.PRODUCT;
    /**
     * 系统版本字符串
     */
    public String sysVersion = Build.VERSION.RELEASE;
    /**
     * 设备参数
     */
    public String deviceName = Build.DEVICE;
    /**
     * 系统定制商
     */
    public String brand = Build.BRAND;
    /**
     * 硬件制造商
     */
    public String manufacturer = Build.MANUFACTURER;
    /**
     * 语言
     */
    public String laguage;
    /**
     * 地区
     */
    public String area;
    /**
     * imei
     */
    public String imei;
    /**
     * mac
     */
    public String mac;
    /**
     * 屏幕高度
     */
    public String screenHeight;
    /**
     * 屏幕宽度
     */
    public String screenWidth;
    /**
     * 运营商名称
     */
    public String networkData;
    /**
     * 前摄像头分辨率
     */
    public String frontCameraPixels;
    /**
     * 后摄像头分辨率
     */
    public String rearCameraPixels;
    /**
     * 总内存
     */
    public String ram;
    /**
     * 总存储
     */
    public String rom;
    /**
     * ip
     */
    public String ip;
    /**
     * 网络类型：WIFI或MOBILE
     */
    public String networkEnvironment;
    /**
     * cpu型号
     */
    public String cpu;

    public ASDeviceInfoBean(){
        this.appId = ASBuilder.APPID;
        this.product = ASBuilder.KEY_PRODUCT;
        this.token = ASBuilder.KEY_TOKEN;
        this.version = ASBuilder.KEY_SDK_VERSION;
    }


    public void setAppId(String appId) {
        this.appId = appId;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public void setProduct(String product) {
        this.product = product;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public void setBorrowId(String borrowId) {
        this.borrowId = borrowId;
    }

    public void setPhoneModel(String phoneModel) {
        this.phoneModel = phoneModel;
    }

    public void setSysVersion(String sysVersion) {
        this.sysVersion = sysVersion;
    }

    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }

    public void setLaguage(String laguage) {
        this.laguage = laguage;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public void setMac(String mac) {
        this.mac = mac;
    }

    public void setScreenHeight(String screenHeight) {
        this.screenHeight = screenHeight;
    }

    public void setScreenWidth(String screenWidth) {
        this.screenWidth = screenWidth;
    }

    public void setNetworkData(String networkData) {
        this.networkData = networkData;
    }

    public void setFrontCameraPixels(String frontCameraPixels) {
        this.frontCameraPixels = frontCameraPixels;
    }

    public void setRearCameraPixels(String rearCameraPixels) {
        this.rearCameraPixels = rearCameraPixels;
    }

    public void setRam(String ram) {
        this.ram = ram;
    }

    public void setRom(String rom) {
        this.rom = rom;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public void setNetworkEnvironment(String networkEnvironment) {
        this.networkEnvironment = networkEnvironment;
    }

    public void setCpu(String cpu) {
        this.cpu = cpu;
    }

    /**
     * 生成加密参数
     */
    public String toEncryptParams(String gPath) {
        // 只取链接最后一个/部分，不带/号
        this.path = ASUtil.lastPathForUrl(gPath);

        String content = new Gson().toJson(this).trim();
        ASLogger.d(this.getClass().getSimpleName(), "aes before：\n" + content);

        String result = AESCryptUtilJar.encryptDefault(content);
        ASLogger.d(this.getClass().getSimpleName(), "aes after：\n" + result);
        return result;
    }
}
